<?php
/**
 * Created by PhpStorm.
 * User: BlueIdeaLirui
 * Date: 2019/9/27
 * Time: 14:50
 */

namespace console\controllers\platform;

use business\datacenter\services\SupplierBasicCronService;
use yii\console\Controller;

class SupplierBasicController extends Controller
{
    /**
     * 平台供应商基础数据同步
     * php yii platform/supplier-basic/process-supplier-basic-rsync-to-es
     * 参数分别传入1,2 （平台供应商数据、平台开发商数据）
     * $isCreateIndex 传入0则不再创建索引
     */
    public function actionProcessSupplierBasicRsyncToEs($type = 1, $isCreateIndex = 1, $page = 0)
    {
        try {
            (new SupplierBasicCronService())->processSupplierBasicRsyncToEs($type, $isCreateIndex, $page);
            echo date('Y-m-d H:i:s') . "平台供应商基础数据同步到es完成\n";
        } catch (\Exception $ex) {
            \Yii::error($ex->getMessage());
            echo '平台供应商基础数据同步到es出错，错误信息：'.$ex->getMessage();
        }
    }
}
